
from typing import Dict, Any
from fastapi import FastAPI, Request, Response
import uvicorn

app = FastAPI()


@app.middleware("http")
async def add_process_time_header(request: Request, call_next):
    request_headers = dict(request.headers)
    print(request_headers)
    request.state.username= "gary"
    response = await call_next(request)
    return response

@app.get("/")
async def root(req: Request):
    print(req.state.username)
    return {"message": "Hello World"}

if __name__ == "__main__":
    uvicorn.run(app, host="0.0.0.0", port=8100)

